#include <stdlib.h>
#include <stdio.h>

static float imu_data_to_float( const unsigned char data_h, const unsigned char data_l )
{
	union 
	{
		short data_short;
		unsigned short data_ushort;
	} us2s;

	us2s.data_ushort = (((unsigned short)data_h) << 8) | data_l;
	printf("%d\n", us2s.data_ushort) ;

	return (float)us2s.data_short;
}


int main()
{
	char *str = "7.5" ;
	float f = atof(str) ;
	double d = 0.1234567890123;

	printf("%s %.1f\n", str, f) ;

	f = imu_data_to_float(77, 11);
	printf("f=%.1f\n", f) ;			// 19723.0

	f = imu_data_to_float(0x80, 0x00);
	printf("f=%.1f\n", f) ;			// -32768.0

	f = imu_data_to_float(0x80, 0x01);
	printf("f=%.1f\n", f) ;			// -32767.0
	printf("f=%.1f\n", f/16384.0) ;	// -2.0

	printf("%.1f\n", (float)7711) ;	// 7711.0

	printf("%6.7lf\n", d) ;			// 0.1234568
	printf("x=%18.16lf\n", 0.12345678912345678);	// x=0.1234567891234568

	return 0;
}
